import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:wallet_utils/base_router_config.dart';
import 'package:wallet_utils/color.dart';
import 'package:wallet_utils/el_refresh.dart';
import 'package:wallet_utils/event_bus_utils.dart';
import 'package:wallet_utils/hopson_cash_ts.dart';
import 'package:wallet_utils/ht_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wallet_utils/ht_common_widgets.dart';
import 'package:wallet_utils/msg_event_utils.dart';
import 'package:wallet_utils/report_widget/click_widget.dart';
import 'package:wallet_utils/text_style.dart';
import 'logic.dart';

class HXHAuditRejectPage extends StatelessWidget {
  final logic = Get.put(HXHAuditRejectLogic());
  final state = Get.find<HXHAuditRejectLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: ColorManager.colorF4F5F6,
        appBar: htCommonAppbar(context, title: '审核未通过'),
        body: elRefresh(
          height: 50.w,
          refreshController: state.refreshController,
          enablePullUp: false,
          onRefresh: () async {
            // logic.obtainProductInfoV2();
          },
          child: GetBuilder<HXHAuditRejectLogic>(builder: (logic) {
            return Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Container(
                  margin: EdgeInsets.only(top: 14.w, left: 156.sp),
                  child: Row(
                    children: [
                      Image.asset('images/hxh_audit_header.png',
                          width: 18.w, height: 14.h),
                      Text('恒小花',
                          style: TextStyleUtils.style000000(
                              fontSize: 12.sp, fontWeight: Medium)),
                    ],
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(top: 14.w, left: 133.sp),
                  child: Row(
                    children: [
                      Image.asset('images/hxh_audit_reject.png',
                          width: 20.w, height: 20.h),
                      Text('审核未通过',
                          style: TextStyleUtils.style000000(
                              fontSize: 16.sp, fontWeight: Medium)),
                    ],
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(top: 5.w),
                  // color: ColorManager.colorFFFFFF,
                  child: Text('审核时间 2023-12-12 11:11: 11',
                      style: TextStyleUtils.style666666(fontSize: 12.sp)),
                ),
                SizedBox(
                  height: 30.w,
                ),
                Container(
                  color: ColorManager.colorFFFFFF,
                  width: MediaQuery.of(context).size.width - 30,
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Container(
                        margin: EdgeInsets.only(
                            left: 15.w, top: 15.w, bottom: 15.w),
                        child: Text('为您推荐其他热门产品',
                            style: TextStyleUtils.style000000(
                                fontSize: 18.w, fontWeight: Medium)),
                      ),
                      MediaQuery.removePadding(
                          context: context,
                          removeTop: true,
                          child: Container(
                            color: ColorManager.colorF4F5F6,
                            child: ListView.builder(
                              shrinkWrap: true,
                              // itemCount: logic.productList!.isNotEmpty ? logic.productList!.length - 1 : 0,
                              itemCount: 5,
                              physics: const NeverScrollableScrollPhysics(),
                              itemBuilder: ((context, index) {
                                return productItem(index + 1);
                              }),
                            ),
                          )),
                    ],
                  ),
                ),
              ],
            );
          }),
        ));
  }

  Container productItem(int index) {
    return Container(
      height: 132.w,
      decoration: BoxDecoration(
        color: ColorManager.colorFFFFFF,
      ),
      child: Column(
        children: [
          Container(
            margin: EdgeInsets.only(top: 10.w, left: 15.w),
            child: Row(
              children: [
                Image.asset('images/hxh_audit_header.png',
                    width: 18.w, height: 14.h),
                Text('恒小花',
                    style: TextStyleUtils.style000000(
                        fontSize: 12.sp, fontWeight: Medium)),
              ],
            ),
          ),
          Container(
            margin: EdgeInsets.only(top: 10.w,left: 15.w,right: 15.w),

            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(
                      // logic.productList![index].loanAmount ?? '',
                      '30-50万',
                      style: TextStyleUtils.styleF73326(
                          fontSize: 18.w, fontWeight: FontWeight.bold),
                    ),
                    SizedBox(
                      height: 2.w,
                    ),
                    Text(
                      '最高可借金额',
                      style: TextStyleUtils.style999999(fontSize: 12.w),
                    )
                  ],
                ),
                Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(
                      // logic.productList![index].loanAmount ?? '',
                      '23月',
                      style: TextStyleUtils.style000000(
                          fontSize: 18.w, fontWeight: FontWeight.bold),
                    ),
                    SizedBox(
                      height: 2.w,
                    ),
                    Text(
                      '借款期限',
                      style: TextStyleUtils.style999999(fontSize: 12.w),
                    )
                  ],
                ),
                Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(
                      // logic.productList![index].loanAmount ?? '',
                      '12.00%',
                      style: TextStyleUtils.style000000(
                          fontSize: 18.w, fontWeight: FontWeight.bold),
                    ),
                    SizedBox(
                      height: 2.w,
                    ),
                    Text(
                      '综合年化',
                      style: TextStyleUtils.style999999(fontSize: 12.w),
                    )
                  ],
                ),
              ],
            ),
          ),
          Container(
            margin: EdgeInsets.only(top: 10.w,left: 248.sp),
            child: ClickWidget(
              onTap: () {
                // logic.popover(2,index);
              },
              child: Container(
                height: 30.w,
                width: 80.w,
                padding: EdgeInsets.only(left: 19.w, right: 19.w),
                alignment: const Alignment(0, 0),
                decoration: BoxDecoration(
                  color: ColorManager.colorFFFFFF,
                  //设置四周圆角 角度 这里的角度应该为 父Container height 的一半
                  borderRadius:
                  const BorderRadius.all(Radius.circular(15.0)),
                  //边框线宽、颜色
                  border: Border.all(
                      width: 1.0, color: ColorManager.color1D52FF),
                ),
                child: Text(
                  '去申请',
                  style: TextStyleUtils.style1D52FF(
                      fontSize: 12.sp, fontWeight: Medium),
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
